(use-package elfeed
  :if (string-equal "antelope" (system-name))
  :custom
  (elfeed-db-directory (expand-file-name "feed/db" org-directory))
  :bind
  ("C-c u r" . elfeed)
  (:map elfeed-search-mode-map
	("q" . bjm/elfeed-save-db-and-bury)
	("f" . qrthi/elfeed-toggle-favorites)
	("l" . qrthi/elfeed-toggle-readlater)
	("F" . qrthi/elfeed-search-set-filter-favorites)
	("L" . qrthi/elfeed-search-set-filter-readlater)
	("P" . qrthi/elfeed-search-set-filter-politics)
	("C" . qrthi/elfeed-search-set-filter-consumer)
	("S" . elfeed-search-clear-filter)
	)
  (:map elfeed-show-mode-map
	("l" . qrthi/elfeed-show-tag-readlater))
  :custom-face
  (elfeed-search-title-face ((t :foreground "gray40")))
  ;; (elfeed-search-read-title-face ((t :foreground black)))
  (elfeed-search-favorites-title-face ((t (:background "pink" :distant-foreground "white"))))
  (elfeed-search-readlater-title-face ((t (:background "green" :distant-foreground "white"))))
  (elfeed-search-video-title-face ((t (:foreground "forestgreen"))))
  (elfeed-search-unread-title-face ((t (:foreground nil :background nil))))
  :custom
  (elfeed-search-filter "@1-months-ago +unread -politics -consumer")
  (elfeed-search-face-alist
   '((favorites elfeed-search-favorites-title-face)
     (unread elfeed-search-unread-title-face)
     (video elfeed-search-video-title-face)
     (readlater elfeed-search-readlater-title-face)))
  (elfeed-search-date-format '("%y/%m/%d" 8 :left))
  :init
  (defun qrthi/elfeed-toggle-favorites ()
    (interactive)
    (elfeed-search-toggle-all 'favorites))
  (defun qrthi/elfeed-toggle-readlater ()
    (interactive)
    (elfeed-search-toggle-all 'readlater))
  (defun qrthi/elfeed-search-set-filter ()
    (interactive)
    (elfeed-search-set-filter elfeed-search-filter))
  (defun qrthi/elfeed-search-set-filter-consumer ()
    (interactive)
    (elfeed-search-set-filter "+consumer +unread"))
  (defun qrthi/elfeed-search-set-filter-favorites ()
    (interactive)
    (elfeed-search-set-filter "+favorites"))
  (defun qrthi/elfeed-search-set-filter-politics ()
    (interactive)
    (elfeed-search-set-filter "+politics +unread @1-months-ago"))
  (defun qrthi/elfeed-search-set-filter-readlater ()
    (interactive)
    (elfeed-search-set-filter "+readlater"))
  (defun bjm/elfeed-save-db-and-bury ()
    "Wrapper to save the elfeed db to disk before burying buffer"
    (interactive)
    (elfeed-db-save)
    (quit-window))
  (defface elfeed-search-favorites-title-face nil nil)
  (defface elfeed-search-readlater-title-face nil nil)
  (defface elfeed-search-video-title-face nil nil)
  )
